package base.stages
{
	import flash.display.Stage;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	/**
	 * 舞台对象映射
	 * @author devin
	 * 
	 */	
	public class StageReflection extends EventDispatcher
	{
		private static var _stage:Stage;
		private static var _stageWidth:Number;
		private static var _stageHeight:Number;
		
		public function StageReflection()
		{
		}
		
		/**
		 * 舞台对象映射注册
		 * @param stage
		 * 
		 */		
		public static function register(stage:Stage):void
		{
			if(stage == null)return;
			_stage=stage;
			_stageWidth=_stage.stageWidth;
			_stageHeight=_stage.stageHeight;
			_stage.stageFocusRect = false;
			_stage.addEventListener(Event.RESIZE, __onStageReSize);
		}
		
		/**
		 *状态视图发生大小改变时 
		 * @param evt
		 * 
		 */		
		private static function __onStageReSize(evt:Event):void
		{
			_stageWidth=_stage.stageWidth;
			_stageHeight=_stage.stageHeight;
		}
		
		public static function get stage():Stage
		{
			return _stage;
		}
		
		public static function get stageHeight():Number
		{
			return _stageHeight;
		}
		
		public static function get stageWidth():Number
		{
			return _stageWidth;
		}
	}
}